import json,yaml,logging,yagmail
import pytest,os
def read_yaml(file):
    with open(file,'r',encoding='utf-8') as f:
        return yaml.safe_load(f)
def read_json(file):
    with open(file,'r',encoding='utf-8') as e:
        return json.load(e)


# 日志
def log():
    logging.basicConfig(
        filename='rizhi.log',
        filemode='a+',
        level=logging.DEBUG,
        format='%(filename)s' '%(levelname)s' '%(message)s' '%(asctime)s' '%(lineno)d'
    )

# 邮件
def youjian(file):
    mail=yagmail.SMTP(user='2018675435@qq.com',password='nnqakcckuzyqfebd',host='smtp.qq.com')
    mail.send(to='2018675435@qq.com',subject='a3mall',contents='内容',attachments=file)

# allure
def allure():
    pytest.main(['-s',r'D:\Gao6x\Auto_Wms\Lx_yk\Test_Case\Test_case.py','--alluredir=.report','--clean-alluredir'])
    os.system('allure generate .report -o html --clean')

